package org.liang.controller;

import java.util.List;

import org.liang.domain.entity.City;
import org.liang.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;

@RestController
@RequestMapping("/cities")
public class CityController {

    @Autowired
    private CityService service;

    @RequestMapping
    @ResponseBody
    public String getAll() {
        List<City> cities = service.getAll();
        return JSON.toJSONString(cities);
    }
}
